/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * Licensed under Simplified BSD License
 *
 *
 * @Original Author: jin Chen
 * @date: Apr 11, 2005$
 * @version: 1.0
 */
package edu.psu.geovista.app.visualclassifier.classify.v2.control;

import edu.psu.geovista.app.visualclassifier.classify.v2.DefaultESVisualClassifier;

import java.awt.*;

public class BiColorInvertor extends BasicColorInvertor {
    private boolean needInvertRow=false; //true, will do invert along rows; otherwise, do invert along column
    protected Color[][] biColors;//// 

    public BiColorInvertor(DefaultESVisualClassifier vc) {
        super(vc);
    }


    public void invertColor() {
        Color[][] invClr=null;
        if(this.isNeedInvertRow()){
           invClr=BasicColorInvertor.invertBiColorAlongRow(this.getBiColors() );
           this.setNeedInvertRow(false);// 
        }
        else{
           invClr=BasicColorInvertor.invertColorAlongColumn(this.getBiColors() );
           this.setNeedInvertRow(true);// 
        }
        this.vc.displayColors(invClr);
        this.setBiColors(invClr);
    }

    public boolean isNeedInvertRow() {
        return needInvertRow;
    }

    public void setNeedInvertRow(boolean needInvertRow) {
        this.needInvertRow = needInvertRow;
    }

    public Color[][] getBiColors() {
        return biColors;
    }

    public void setBiColors(Color[][] biColors) {
        this.biColors = biColors;
    }
}
